[powerpc] Handle 2 forms of NULL guest handle
authorJimi Xenidis <jimix@watson.ibm.com>
Thu, 13 Jul 2006 15:26:51 +0000 (11:26 -0400)
committerJimi Xenidis <jimix@watson.ibm.com>
Thu, 13 Jul 2006 15:26:51 +0000 (11:26 -0400)
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
xen/arch/powerpc/usercopy.c
xen/include/asm-powerpc/guest_access.h

index 542e70d8b8b677706faae699cc3f12d9191b7189..77ec80c66c14ef224e504c1275b8c49f3fde9547 100644 (file)
@@ -231,3 +231,12 @@ void xencomm_add_offset(void *handle, unsigned int bytes)
         bytes -= chunk_skip;
     }
 }
+
+int xencomm_handle_is_null(void *ptr)
+{
+    struct xencomm_desc *desc;
+
+    desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)ptr);
+
+    return (desc->address[0] == XENCOMM_INVALID);
+}
index 7b776423188677428925b274e214dcc89c8ae052..51f6d501c2017eee97cce0318ffd976c93bb0bd0 100644 (file)
@@ -26,9 +26,12 @@ extern unsigned long xencomm_copy_to_guest(void *to, const void *from,
 extern unsigned long xencomm_copy_from_guest(void *to, const void *from,
         unsigned int len, unsigned int skip); 
 extern void xencomm_add_offset(void *handle, unsigned int bytes);
+extern int xencomm_handle_is_null(void *ptr);
+
 
 /* Is the guest handle a NULL reference? */
-#define guest_handle_is_null(hnd)        ((hnd).p == NULL)
+#define guest_handle_is_null(hnd) \
+    ((hnd).p == NULL || xencomm_handle_is_null((hnd).p))
 
 /* Offset the given guest handle into the array it refers to. */
 #define guest_handle_add_offset(hnd, nr) ({         \